OPC Studio User's Guide and Reference
Browse Paths for OPC Classic
Common Fundamentals > Identifying information in OPC Classic > Browse Paths for OPC Classic
In This Topic

Browse Paths In General

An alternative way (to using a node ID) of specifying a node in OPC address space is using a browse path. The browse path is a sequence of node names, starting from a known location (e.g. the root of the OPC address space). The browse path can also be expressed as a string, where the individual node names are separated by delimiters (e.g. “/”, a slash).

Browse paths can be absolute (starting from a specified node), or relative.

The advantage of the browse paths is that you can construct them yourself, with just knowledge of the node names, without knowing the full node IDs. In the end, each item must be addressed by its node ID, and OPC Studio components will resolve the browse path to a node ID as necessary.

OPC Classic Browse Paths Specifics

In OPC Classic, absolute browse paths always start at the root of the OPC address space, because the root is the only “pre-defined” or well-known node.

An absolute browse path for OPC Classic is contained in a BrowsePath object. Browse paths are commonly specified by the BrowsePath property of the DANodeDescriptor or DAItemDescriptor object. These descriptors can contain the OPC ItemID, the browse path, or both. When both the ItemID and the browse path are included, they must logically correspond to the same OPC item. During an OPC operation, if both parts are included, OPC Studio components will pick either the ItemID, or the browse path, for use with the operation, depending on what is possible to use at given circumstances, and what is more effective.

If a non-null ItemID is specified in the descriptor, OPC Studio components will in most cases use this item Id and ignore the browse path. If ItemID is null, OPC Studio components will attempt to directly use the browse path contained in the BrowsePath property of the descriptor, or resolve it to ItemID first. Either item id, or browse path (or both) must be specified.

Besides the ability to get around usage of full node IDs, the other reason to use browse paths is for OPC browsing with OPC Servers that only support OPC Data Access 1.0 specification. Such OPC servers cannot start the browsing at a node in the address given just by its Item ID; the node must always be reached by browsing from the root level. If the ID of such node it already known, OPC Studio Components take care of supplying the proper browse path automatically, but this cannot be always done. If, however, a browse path is given (which can be done by using the DANodeElement that is the output of the browsing to construct the DANodeDescriptor that is the input of further browsing), the browsing can proceed normally.

Examples

// This example shows how to read a single item using a browse path, and display its value, timestamp and quality.
//
// Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .

using System;
using OpcLabs.EasyOpc;
using OpcLabs.EasyOpc.DataAccess;
using OpcLabs.EasyOpc.OperationModel;

namespace DocExamples.DataAccess._EasyDAClient
{
    partial class ReadItem
    {
        public static void BrowsePath()
        {
            // Instantiate the client object.
            var client = new EasyDAClient();

            DAVtq vtq;
            try
            {
                vtq = client.ReadItem(
                    new ServerDescriptor("", "OPCLabs.KitServer.2"),
                    new DAItemDescriptor(null, "/Simulation/Random"));
            }
            catch (OpcException opcException)
            {
                Console.WriteLine("*** Failure: {0}", opcException.GetBaseException().Message);
                return;
            }

            Console.WriteLine("Vtq: {0}", vtq);
        }
    }
}
# This example shows how to read a single item using a browse path, and display its value, timestamp and quality.
#
# Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .
# OPC client and subscriber examples in Python on GitHub: https://github.com/OPCLabs/Examples-QuickOPC-Python .
# The QuickOPC package is needed. Install it using "pip install opclabs_quickopc".
import opclabs_quickopc

# Import .NET namespaces.
from OpcLabs.BaseLib.Navigation import *
from OpcLabs.EasyOpc import *
from OpcLabs.EasyOpc.DataAccess import *
from OpcLabs.EasyOpc.OperationModel import *


# Instantiate the client object.
client = EasyDAClient()

# Perform the operation.
try:
    vtq = IEasyDAClientExtension.ReadItem(client,
                                          ServerDescriptor('', 'OPCLabs.KitServer.2'),
                                          DAItemDescriptor(None, BrowsePath('/Simulation/Random')))
except OpcException as opcException:
    print('*** Failure: ' + opcException.GetBaseException().Message)
    exit()

# Display results.
print('Vtq: ', vtq, sep='')
' This example shows how to read a single item using a browse path, and display its value, timestamp and quality.
'
' Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .

Imports OpcLabs.EasyOpc
Imports OpcLabs.EasyOpc.DataAccess
Imports OpcLabs.EasyOpc.OperationModel

Namespace DataAccess._EasyDAClient
    Partial Friend Class ReadItem
        Public Shared Sub BrowsePath()
            Dim client = New EasyDAClient()

            Dim vtq As DAVtq
            Try
                vtq = client.ReadItem(New ServerDescriptor("", "OPCLabs.KitServer.2"), New DAItemDescriptor(Nothing, "/Simulation/Random"))
            Catch opcException As OpcException
                Console.WriteLine("*** Failure: {0}", opcException.GetBaseException().Message)
                Exit Sub
            End Try

            Console.WriteLine("Vtq: {0}", vtq)
        End Sub
    End Class
End Namespace

 

See Also

Examples - OPC Data Access